1   /*
2    * Copyright (C) 2012 The Guava Authors
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11   * or implied. See the License for the specific language governing permissions and limitations under
12   * the License.
13   */
14  
15  package com.google.common.collect.testing.google;
16  
17  import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
18  
19  import com.google.common.annotations.GwtCompatible;
20  import com.google.common.collect.SetMultimap;
21  import com.google.common.collect.testing.Helpers;
22  import com.google.common.collect.testing.features.CollectionSize;
23  import com.google.common.testing.EqualsTester;
24  
25  /**
26   * Testers for {@link SetMultimap#equals(Object)}.
27   *
28   * @author Louis Wasserman
29   */
30  @GwtCompatible
31  public class SetMultimapEqualsTester<K, V> 
32      extends AbstractMultimapTester<K, V, SetMultimap<K, V>> {
33    @CollectionSize.Require(SEVERAL)
34    public void testOrderingDoesntAffectEqualsComparisons() {
35      SetMultimap<K, V> multimap1 = getSubjectGenerator().create(
36          Helpers.mapEntry(sampleKeys().e0, sampleValues().e0),
37          Helpers.mapEntry(sampleKeys().e0, sampleValues().e1),
38          Helpers.mapEntry(sampleKeys().e0, sampleValues().e4));
39      SetMultimap<K, V> multimap2 = getSubjectGenerator().create(
40          Helpers.mapEntry(sampleKeys().e0, sampleValues().e1),
41          Helpers.mapEntry(sampleKeys().e0, sampleValues().e0),
42          Helpers.mapEntry(sampleKeys().e0, sampleValues().e4));
43      new EqualsTester()
44          .addEqualityGroup(multimap1, multimap2)
45          .testEquals();
46    }
47  }